package com.fyf.game.net.business.server;

import java.util.List;
import org.je.util.StringUtil;
import com.fyf.game.net.Sender;
import com.fyf.game.net.business.Cmd;

/**
 * @author fanyifeng 2013-1-10
 */
public class ChartHandler
{
	public void doChart(String target, String msg, Sender sender) {
		if (target.equals(Cmd.chart_to_all)) {
			Sender[] sds = sender.getBox().getAllSenders();
			for (Sender sd : sds) {
				sd.send(Cmd.chart + Cmd.spr + sender.getName() + Cmd.spr + msg);
			}
			return;
		}
		List<String> idList = StringUtil.split(target, "#");
		for (String id : idList) {
			Sender sd = sender.getBox().getSender(id);
			if (sd != null) {
				sd.send(Cmd.chart + Cmd.spr + sender.getName() + Cmd.spr + msg);
			}
		}
	}
}
